package com.ldz.eb.contoller;

import com.baomidou.mybatisplus.core.mapper.Mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ldz.eb.mapper.EbProductMapper;
import com.ldz.eb.service.IndexService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import sun.security.pkcs11.Secmod;

import javax.annotation.Resource;
import java.util.Map;

@Controller
@RequestMapping("/index")
public class IndexController {
    @Resource
    private IndexService indSer;
    @RequestMapping("/index")
public String index(Model model,
                    @RequestParam(value="p",defaultValue = "1") int p,
                    @RequestParam(value="ps",defaultValue = "8") int ps){

        System.out.println("收到请求");
        Map<String,Page> goalMap = indSer.index(p,ps);
        model.addAttribute("goalMap",goalMap);
    return "index";
        }
    }
